# -*- coding: utf-8 -*-
# Author: tom
# time: 2024/3/1 17:47
# description： 获取取data中的yaml信息
import configparser, os


class Configure:
    __config_file = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'config',
                                 'config.ini')

    __repository_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'yaml_data',
                                     'xbase_asset_repository.yaml')
    __component_repository_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'yaml_data',
                                               'xbase_component_repository.yaml')

    __result_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'allure_report')

    __report_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'allure_result')

    __html_report_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'html_report')

    def __init__(self):
        # conf = configparser.ConfigParser()
        # conf.read(Configure.__config_file)
        # 从config.ini中获取配置信息
        # self.__repository_path = conf.get('repository', 'repository_path')
        # self.__report_path = conf.get('report', 'report_path')
        # self.__result_path = conf.get('report', 'result_path')

        self.__repository_path = Configure.__repository_path
        self.__report_path = Configure.__result_path
        self.__result_path = Configure.__report_path
        self.__html_report_path = Configure.__html_report_path

    @property
    def repository_path(self):
        """
        获取config.ini中repository_path
        :return:
        """
        return self.__repository_path

    @property
    def component_repository_path(self):
        """
        获取config.ini中repository_path
        :return:
        """
        return self.__component_repository_path

    @property
    def report_path(self):
        """
        获取config.ini中report_path
        :return:
        """
        return self.__report_path

    @property
    def result_path(self):
        """
        获取config.ini中result_path
        :return:
        """
        return self.__result_path

    @property
    def html_report_path(self):
        return self.__html_report_path


# 初始化配置文件信息，只执行一次
config = Configure()
